﻿#region COPYRIGHT
//--------------------------------------------------------------------------------
// <copyright file="ToolStripItemCollection.cs" company="starLiGHT Entertainment Studios">
//    Copyright (c) 2011 
//       Roland Rosenkranz (Glatzemann@email.de)
// </copyright>
// <license>
//   This file is part of starLiGHT.GUI.
//
//   It is released under the Microsoft Public License (Ms-PL).
//
//   You should have received a copy of the Microsoft Public License
//   along with starLiGHT.GUI. If not, see http://sle.codeplex.com/license.
//    
//   ADDITIONAL (commercial) LICENSES for starLiGHT.GUI are available on request.
// </license>
// <version>
// **************[ starLiGHT.Engine SVN ]**********************
// * $Rev:: 9923                  $:  Revision of last commit *
// * $Author:: unknown            $:  Author of last commit   *
// * $Date:: 2011-05-10 14:48:29 #$:  Date of last commit     *
// ************************************************************
// </version>
//--------------------------------------------------------------------------------
#endregion

namespace starLiGHT.GUI
{
    #region Using Statements
    using System;
    using System.Collections;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using Microsoft.Xna.Framework;
    using starLiGHT.GUI.Widgets;
    #endregion

    public class ToolStripItemCollection : List<ToolStripItem>, IList, ICollection, IEnumerable
    {
        #region Private Members
        private ToolStrip toolStrip;
        #endregion

        public ToolStripItemCollection(ToolStrip toolStrip)
        {
            if (toolStrip == null)
            {
                throw new ArgumentNullException("toolStrip");
            }

            this.toolStrip = toolStrip;
        }

        #region Events
        public event EventHandler ItemAdded;
        #endregion

        public void Add(ToolStripItem item)
        {
            item.ToolStrip = this.toolStrip;
            base.Add(item);

            if (this.ItemAdded != null)
            {
                this.ItemAdded(this, EventArgs.Empty);
            }
        }

        public void AddRange(ToolStripItem[] items)
        {
            foreach (ToolStripItem tsi in items)
            {
                this.Add(tsi);
            }
        }
    }
}
